﻿using System;

namespace T009EasyFactoryMode
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Console.Write("请输入数字A:");
                double numberA = double.Parse(Console.ReadLine());
                Console.WriteLine("请输入运算符(+-*/)");
                string strOperation=Console.ReadLine();
                Console.Write("请输入数字B:");
                double numberB = double.Parse(Console.ReadLine());
                Operation operation = SimpleFactory.CreateOperation(strOperation);
                operation.NumberA = numberA;
                operation.NumberB = numberB;
                double result = operation.GetResult();
                Console.WriteLine("运算结果是:{0}",result);
            }
            catch (System.FormatException e)
            {
                Console.WriteLine("只能输入数字,你个章鱼!");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine(e.ToString());
                Console.WriteLine(e.Source);
            }


        }
    }
}